package com.panda.cn.controller.platform;

import com.panda.cn.config.aspect.OperLog;
import com.panda.cn.config.aspect.OperLogType;
import com.panda.cn.entity.platform.PlAppKeyEntity;
import com.panda.cn.service.platform.PlAppKeyService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * pl应用key程序控制器
 *
 * @author Yanmh
 * @date 2022/10/21
 */
@Slf4j
@RestController
@RequestMapping(value = "/pl/appkeycon")
public class PlAppKeyController {
    
    @Resource
    private PlAppKeyService plAppKeyService;
    
    /**
     * 插入
     *
     * @param params 参数个数
     * @return {@link Long}
     */
    @OperLog(operModul = "应用key模块", operType = OperLogType._ADD, operDesc = "添加应用key信息")
    @RequestMapping(value = "/insert", method = RequestMethod.POST)
    public Long insert(@RequestBody PlAppKeyEntity params) {
        return plAppKeyService.insert(params);
    }
    
    /**
     * 更新
     *
     * @param params 参数个数
     * @return {@link Long}
     */
    @OperLog(operModul = "应用key模块", operType = OperLogType._EDIT, operDesc = "修改应用key的有效状态信息")
    @RequestMapping(value = "/update/valid", method = RequestMethod.POST)
    public Long updateValid(@RequestBody PlAppKeyEntity params) {
        return plAppKeyService.updateValid(params);
    }
    
    /**
     * 更新有效状态
     *
     * @param params 参数个数
     * @return {@link Long}
     */
    @OperLog(operModul = "应用key模块", operType = OperLogType._EDIT, operDesc = "修改应用key信息")
    @RequestMapping(value = "/update", method = RequestMethod.POST)
    public Long update(@RequestBody PlAppKeyEntity params) {
        return plAppKeyService.update(params);
    }
    
    
    /**
     * 逻辑删除
     *
     * @param params 参数个数
     * @return {@link Long}
     */
    @OperLog(operModul = "应用key模块", operType = OperLogType._DEL, operDesc = "删除应用key信息")
    @RequestMapping(value = "/remove", method = RequestMethod.POST)
    public Long remove(@RequestBody List<Long> params) {
        return plAppKeyService.remove(params);
    }
    
}
